<%--
  Created by IntelliJ IDEA.
  User: fire'ge
  Date: 2022/5/11
  Time: 19:21
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<html>
<head>
    <title>购物车</title>
    <link rel="stylesheet" href="/TakeawaySystem/css/Show.css" type="text/css">
</head>
<body>
<div>
    <table id="name-label">
        <tr>
            <td align="center" colspan="4">你好！游客
                <a href="/TakeawaySystem/jsp/UserCenter.jsp">退出</a>  </td>
        </tr>
    </table>
    <table>
        <tr>
            <td id= "tableTopic">
                购 物 车 清 单
            </td>
        </tr>
        <c:if test="${dishNames.size()>0}">

            <c:forEach begin="0" end="${dishNames.size()-1}" var="i">

                <form id="bookForm" method="post">
                    <tr>
                        <td class="shopTopic">
                            菜名：${dishNames[i]}

                        </td>
                    </tr>
                    <tr>
                        <td class="description">
                            描述：${descriptions[i]}
                        </td>
                    </tr>
                    <td>
                            ${dishNums[i]}份
                    </td>
                    <td>
                        <input Type="submit" id="book" name="book" Value="下 订" >
                        <input Type="submit" id="delete" name="delete" Value="删 除" >
                    </td>
                </form>
            </c:forEach>
        </c:if>
    </table>
</div>
</body>
<Script Language="JavaScript">
    let book = document.getElementById("book");
    book.onclick = addBook;
    function addBook()
    {
        document.getElementById("bookForm").action="addCartBook";
        document.getElementById("bookForm").submit();
    }

    let delete_ = document.getElementById("delete");
    delete_.onclick = deleteCart;
    function deleteCart()
    {
        document.getElementById("bookForm").action="user/deleteCart";
        document.getElementById("bookForm").submit();
    }

</Script>
</html>
